
<%@ page import="com.cn.entity.NewsInfo" %>
<%@ page import="com.cn.Dao.NewsinfoDao" %>
<%--
  Created by IntelliJ IDEA.
  User: cza20
  Date: 2021/4/5
  Time: 21:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head >
    <title>订单详情</title>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" href="css/web.css"/>
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/img/logo2.png" type="image/x-icon">
</head>
<body>


<jsp:include page="index.html"/>
<jsp:include page="WEB-INF/header/header-user.jsp"/>
<jsp:useBean id="userInfo" class="com.cn.entity.UserInfo" scope="session"/>
<jsp:useBean id="newsInfo" class="com.cn.entity.NewsInfo" scope="session"/>
<%
    Object message = request.getAttribute("message");
    if (message != null && message!=""){
%>
<script type="text/javascript">
    alert("<%=message%>")
</script>
<%}%>
<%request.setAttribute("message","");%>

<%

    String news_id =  request.getParameter("ID");
    NewsInfo new1 = new NewsInfo();
    NewsinfoDao newsinfoDao =new NewsinfoDao();
    new1 =  newsinfoDao.findByName(news_id);
    String name=new1.getName();
    String month=request.getParameter("months");
    String copy=request.getParameter("copies");
    Float price=Integer.parseInt(request.getParameter("copies"))*Integer.parseInt(request.getParameter("months"))*new1.getPrice();
%>
<div class="container" ng-controller="userCtrl" ng-init="getUser()">
    <h3>订单详情</h3>
    <div class="row">
        <div class="col-xs-3 text-right" style="font-weight: 300">
            用户：
        </div>
        <div class="col-xs-9 text-left">
            <jsp:getProperty name="userInfo" property="username"/>
        </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-xs-3 text-right" style="font-weight: 300">
            订购刊物：
        </div>
        <div class="col-xs-9 text-left">
            <%
                out.write("<p><a style='color: green'>"+'《'+name+"》"+"</a></p>");
            %>
        </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-xs-3 text-right" style="font-weight: 300">
            订购月数：
        </div>
         <div class="col-xs-9 text-left">
             <%
                 out.write(month);
             %>
         </div>
    </div>
    <hr/>
    <div class="row">
         <div class="col-xs-3 text-right" style="font-weight: 300">
            订购份数：
         </div>
         <div class="col-xs-9 text-left" style="font-weight: 300">
            <%
                out.write(copy);
            %>
         </div>
    </div>
    <hr/>
    <div class="row">
        <div class="col-xs-3 text-right" style="font-weight: 300">
            总金额：
        </div>
        <div class="col-xs-9 text-left" style="font-weight: 300" >
            <%
                out.write("￥"+price);
            %>
        </div>
    </div>
</div>
<hr/>
<div class="col-sm-offset-2 col-sm-10">
    <%
    String id =  request.getParameter("ID");
    %>
    <button style="width: 100px;float: right;margin-right: 10px"  onclick="javascript:history.back(-1);" class="btn btn-primary btn-large" >返回</button>&nbsp;&nbsp;
    <button style="width: 100px;float: right" type="submit" class="btn btn-primary btn-large" onclick="bt1Click()">提交</button>
</div>
<script type="text/javascript">
    function bt1Click() {
        window.location="InsertBookServlet?num=<%=news_id%>&copy=<%=copy%>&month=<%=month%>&price=<%=price%>"
    }
</script>
</body>
</html>
